{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "199e25ee",
   "metadata": {},
   "source": [
    "# 第一周学习内容 \n",
    "\n",
    "* A.python的第一行代码\n",
    "* B.观察标准库"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f84c43d2",
   "metadata": {},
   "source": [
    "> ps: 人生苦短，我选python (Python 的设计哲学是“优雅”、“明确”、“简单”)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "af803b11",
   "metadata": {},
   "source": [
    "##  重要资源  \n",
    "\n",
    ">[python官网](https://python.org)\n",
    "\n",
    ">[Zhichao blogs](https://cnblogs.com/xuzhichao)\n",
    "\n",
    "---\n",
    "# 第二周学习内容  \n",
    "* python环境配置  \n",
    "[pycharm](https://www.jetbrains.com/pycharm/) \n",
    "\n",
    "* 项目管理类的IDE  \n",
    "[github education pack](https://education.github.com/pack)可获取免费一年 专业版使用\n",
    "\n",
    "* jupyter的运用 \n",
    ">1. 打开cmd\n",
    ">2. 输入jupyter notebook\n",
    ">3. 跳转到其网页，新建python文件夹和文件，便可以开始操作啦！\n",
    ">> 注意：在Jupyter Notebook的所有操作，都保持终端不要关闭，因为一旦关闭终端，就会断开与本地服务器的链接。\n",
    "---\n",
    "\n",
    "## 变量、赋值、数据  \n",
    "\n",
    ">变量定义的规则：\n",
    ">变量名只能是 字母、数字或下划线的任意组合\n",
    ">变量名的第一个字符不能是数字\n",
    ">>以下关键字不能声明为变量名  \n",
    "*['and', 'as', 'assert', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'exec', 'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda','not', 'or', 'pass', 'print', 'raise', 'return', 'try', 'while', 'with', 'yield']*\n",
    "\n",
    ">Python 中的变量不需要声明。每个变量在使用前都必须赋值，变量赋值以后该变量才会被创建。\n",
    ">>等号（=）用来给变量赋值。  \n",
    ">>等号（=）运算符左边是一个变量名,等号（=）运算符右边是存储在变量中的值。例如：\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "de5e37cd",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "100\n",
      "1000.0\n",
      "xinxin\n"
     ]
    }
   ],
   "source": [
    "counter = 100          # 整型变量\n",
    "miles   = 1000.0       # 浮点型变量\n",
    "name    = \"xinxin\"     # 字符串\n",
    "\n",
    "print (counter)\n",
    "print (miles)\n",
    "print (name)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "514a83f6",
   "metadata": {},
   "source": [
    "> 多个变量赋值\n",
    "> Python允许你同时为多个变量赋值。例如："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "96440a74",
   "metadata": {},
   "outputs": [],
   "source": [
    "a = b = c = 1\n",
    "\n",
    "#以上实例，创建一个整型对象，值为 1，从后向前赋值，三个变量被赋予相同的数值。"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d5d39dbe",
   "metadata": {},
   "source": [
    ">您也可以为多个对象指定多个变量。例如："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "58a984de",
   "metadata": {},
   "outputs": [],
   "source": [
    "a, b, c = 1, 2, \"xinxin\"\n",
    "\n",
    "#以上实例，两个整型对象 1 和 2 的分配给变量 a 和 b，字符串对象 \"xinxin 分配给变量 c"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "00493f6d",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "apple apple\n",
      "banana apple\n"
     ]
    }
   ],
   "source": [
    "#变量赋值其他案例\n",
    "\n",
    "name = \"apple\"\n",
    "\n",
    "name2 = name\n",
    "\n",
    "print(name,name2)\n",
    "\n",
    "name = \"banana\"\n",
    "\n",
    "print(name,name2)\n",
    "\n",
    "# 变量创建后为独立个体，仅执行一次"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f83ca9c9",
   "metadata": {},
   "source": [
    "---"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4eca8418",
   "metadata": {},
   "source": [
    "## by the way，说说字符串\n",
    "\n",
    "* 基本介绍\n",
    "\n",
    "单引号 ' '或者双引号 \" \" 都可以，再或者 ''' ''' 三个引号，其中三个引号被用于过于长段的文字或者是说明，只要是三引号不完就可以随意换行写下文字。\n",
    "\n",
    "> 1.字符串直接能相加，如："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "fdc08f4c",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "吃晚饭\n"
     ]
    }
   ],
   "source": [
    "print (\"吃\" + \"晚饭\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "3faf9ef3",
   "metadata": {},
   "source": [
    "> 2.字符串相乘，如："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "e78c4d3a",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "bang!bang!bang!\n"
     ]
    }
   ],
   "source": [
    "string = 'bang!'\n",
    "total = string * 3\n",
    "print (total)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "dfe1d98a",
   "metadata": {},
   "source": [
    "---"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "9cb5063b",
   "metadata": {},
   "source": [
    "## 项目一： 奇数中选择指定的时间"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "955fb053",
   "metadata": {},
   "source": [
    "### if&else\n",
    "\n",
    " 注：if语句\n",
    "\n",
    "   if 条件:\n",
    "      if-语句块\n",
    "   \n",
    "   if 条件:\n",
    "      if-语句块\n",
    "      \n",
    "   else:\n",
    "      else-语句块\n",
    "   \n",
    "   if 条件：\n",
    "      if-语句块\n",
    "      \n",
    "   elif 条件:\n",
    "      elif-语句块...\n",
    "   \n",
    "   else:\n",
    "      else-语句块\n",
    "   \n",
    "   可以进行嵌套。 不要超过3层， 最多5层\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "08fa6e16",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 准备工作 （要用到的模块和函数）\n",
    "from datetime import datetime"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "952f103f",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "datetime.datetime(2021, 10, 7, 21, 2, 50, 697846)"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "datetime.today()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "e9177b41",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Not an odd minute.\n"
     ]
    }
   ],
   "source": [
    "# 课本代码 （奇数中选择指定的时间）\n",
    "\n",
    "odds = [1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,57,59]\n",
    "\n",
    "right_this_minute = datetime.today().minute\n",
    "\n",
    "if right_this_minute in odds:\n",
    "    print(\"时间是奇数，时间在odds的数据中\")\n",
    "else:\n",
    "    print(\"Not an odd minute.\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "c9b0c404",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "id": "59f06022",
   "metadata": {},
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
